import com.baorant.A;
import com.baorant.B;
import com.baorant.HelloWorld;
import com.baorant.config.TestConfiguration;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class Test {
    public static void main(String[] args) {
//        ApplicationContext applicationContext =
//                new ClassPathXmlApplicationContext("beans.xml");
////         场景1：测试配置文件场景
//        HelloWorld helloWorld = (HelloWorld) applicationContext.getBean("helloWorld");
//        helloWorld.getMsg();

//        //         场景2：测试自动装配场景场景
//        A a = (A) applicationContext.getBean("a");
////        a.setB(new B());
//        a.Hellob();

        //         场景3：测试注解类使用场景
        ApplicationContext ctx = new AnnotationConfigApplicationContext(TestConfiguration.class);
        HelloWorld helloWorld = ctx.getBean(HelloWorld.class);
        helloWorld.setMsg("Hello World!");
        helloWorld.getMsg();
    }
}
